<template>
  <image-viewer
    v-if="showViewer"
    :z-index="viewerZIndex"
    :initial-index="imageIndex"
    :on-close="closeViewer"
    :mask-closable="true"
    :url-list="previewSrcList"
  />
</template>
<script lang="ts" setup>
import ImageViewer from 'element-plus/packages/image/src/image-viewer.vue'
// import { PopupManager } from 'element-plus/lib/utils/popup'
import { ref, computed } from 'vue'

const showViewer = ref(false)
const clickHandler = () => {
  if (!this.preview) {
    return
  }
  prevOverflow = document.body.style.overflow
  document.body.style.overflow = 'hidden'
  this.showViewer = true
}
computed({
    imageIndex() {
      let previewIndex = 0;
      const srcIndex = this.previewSrcList.indexOf(this.src);
      if (srcIndex >= 0) {
        previewIndex = srcIndex;
      }
      return previewIndex;
    },

})
</script>